using MicroMsg.Manager;
using Microsoft.Phone.Controls;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class SetBackgroundItem : UserControl
	{
		public delegate void BackgroundItemClick(object sender, object object_0);
		public PacageData mPacageData;
		internal Button LayoutItem;
		internal Image imgSample;
		internal Image imgBar;
		internal Image imgSelected;
		internal DynamicTextBlock txtDownload;
		private bool _contentLoaded;
		public event SetBackgroundItem.BackgroundItemClick ItemClick;
		public SetBackgroundItem(PacageData pacageData)
		{
			this.mPacageData = pacageData;
			this.InitializeComponent();
			base.SetValue(TiltEffect.IsTiltEnabledProperty, true);
			this.LayoutItem.set_DataContext(this);
		}
		public void SetSelected(bool isSelected)
		{
			if (isSelected)
			{
				this.imgBar.set_Visibility(0);
				this.imgSelected.set_Visibility(0);
				this.txtDownload.set_Visibility(1);
				return;
			}
			if (PackageDataMgr.isPackBigFileNameExist(this.mPacageData))
			{
				this.imgBar.set_Visibility(1);
				this.imgSelected.set_Visibility(1);
				this.txtDownload.set_Visibility(1);
				return;
			}
			this.imgBar.set_Visibility(0);
			this.imgSelected.set_Visibility(1);
			this.txtDownload.set_Visibility(0);
		}
		private void btnLayoutRoot_Click(object sender, RoutedEventArgs e)
		{
			if (this.ItemClick != null)
			{
				this.ItemClick(this, null);
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Chat/background/SetBackgroundItem.xaml", 2));
			this.LayoutItem = (Button)base.FindName("LayoutItem");
			this.imgSample = (Image)base.FindName("imgSample");
			this.imgBar = (Image)base.FindName("imgBar");
			this.imgSelected = (Image)base.FindName("imgSelected");
			this.txtDownload = (DynamicTextBlock)base.FindName("txtDownload");
		}
	}
}
